<?php
function read_collection($filename) {
	$lines=file($filename);
	$contents="";
	while(list($key,$value)=each($lines)) {
		$contents.=$value;
	}
	return $contents;
}
function startElement($parser, $name, $attrs) {
	global $depth;
	$spacer="";
	for ($i=1;$i<$depth[$parser];$i++) {
		$spacer.="-&gt;";
	}
	if($depth[$parser]==0) {
		$font_color= "red";
	} elseif($depth[$parser]==1) {
		$font_color= "green";
	} else {
		$font_color="blue";
	}
	$font_size=5-$depth[$parser];
	if ($font_size < 2) {
		$font_size=2;
	}
	echo "<font size=".$font_size."color=".$font_color.">";
	if ($depth[$parser]<>0) {
		echo "、";
	}
	echo $name."<br />";
	echo "</font>";
	$depth[$parser]++;
	if($depth[$parser]==2) {
		echo "<hr color=red size=1>";
	}
}
function endElement($parser,$name) {
	global $depth;
	$depth[$parser]--;
	if($depth[$parser]==2) {
		echo "<hr color=red size=1>";
	}
}
function characterData($parser,$data) {
	global $depth;
	$data=trim($data);
	if (strlen($data)) {
		for ($i=1;$i<$depth[$parser]+6;$i++) {
			echo "&nbsp";
			echo "<b>$data</b><br />\n";
		}
	}
}
?>

